home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Alles Voor Internet / Tout Pour Internet
/
alles voor internet.iso
/
MacInternet™
/
Telnet
/
NCSA
/
tn3270 2.4d7 source
/
NCSA⁄BYU TCP⁄IP
/
fastnet.c
< prev
next >
Wrap
Text File
|
1991-06-27
|
3KB
|
142 lines
#ifndef lint
static char *SCCSid = "%W% (NCSA) %G%";
#endif
/*
* fastnet.c
* by Gaige B. Paulsen
****************************************************************************
* *
* Uses : *
* TCP/IP kernel for NCSA Telnet *
* by Tim Krauskopf *
* with Macintosh code by Gaige B. Paulsen *
* *
* National Center for Supercomputing Applications *
* 152 Computing Applications Building *
* 605 E. Springfield Ave. *
* Champaign, IL 61820 *
* *
* *
****************************************************************************
*
* FastNet init and shutdown (and utility) procs.
*
* Called by:
* ether.c
* mactools.c
* macutil.c
*/
#include <stdio.h>
#include "protocol.h"
#include "data.h"
#include "BoxLayer.h"
#include "datalayer.h"
#include "dlayer.h"
#include "ip.h"
extern char nodeAddress[];
int FNdlayersend /*MAC: replaced */
(
DLAYER *ptr,
unsigned size
)
{
if (size<60) size=60;
DoBoxDataSend( ptr, size);
return(0);
}
/**********************************************************************/
/* FNdemux - FastNet Version of DEMUX routine
*
* returns the number of packets demuxed
*/
int FNdemux
(
int all
)
{
unsigned getcode;
int nmuxed;
typedef struct peek {
unsigned char dest[DADDLEN],
me[DADDLEN];
unsigned type;
} Dpeek;
Dpeek *firstlook;
nmuxed = 0;
do { /* while all flag is on */
if (DoBoxDataRequest(bufinfo.buforg)) { /*MAC*/
nmuxed++;
firstlook = (Dpeek *) bufinfo.buforg; /*MAC where packet is */
getcode = firstlook->type; /* where does it belong? */
switch (getcode) { /* what to do with it? */
case EARP:
case ERARP:
arpinterpret((ARPKT *) firstlook->dest); /* handle [R]ARP packet */
break;
case EIP:
ipinterpret((IPKT *) firstlook->dest); /* handle IP packet */
break;
default:
break;
}
}
else
all = 0;
} while (all); /* should we look for more to deal with? */
return(nmuxed); /* no packets anymore */
}
void getFNaddress
(
char *p
)
{
DoBoxAddrRequest( p);
}
int FNopen
(
void
)
{
DataLinkData lanceData;
getFNaddress(&lanceData.physicalAddress[0]);
/* Initialize address globals (DEC and EtherNet forms) */
lanceData.promiscuousEnable=0;
/* movmem(nodeAddress, &lanceData.physicalAddress[0],6); */
lanceData.protocolCount=3;
lanceData.protocolType[0]=0x0800; /*IP */
lanceData.protocolType[1]=0x0806; /*ARP */
lanceData.protocolType[2]=0x8035; /*RARP*/
lanceData.multicastCount=0;
lanceData.broadcastEnable=1;
DoBoxCommand(&lanceData,sizeof(DataLinkData));
getFNaddress( nnmyaddr);
return(0);
}
int FNclose
(
void
)
{
return
0;
}